package com.interesting.client.adapter;

import java.util.ArrayList;

import com.interesting.R;
import com.interesting.client.bean.Message;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class DetailPagerAdapter extends PagerAdapter {
	private ArrayList<Message> data;

	public DetailPagerAdapter(ArrayList<Message> data, Context context) {
		this.data = data;
	}

	@Override
	public int getCount() {
		return data.size();
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		((ViewPager) container).removeView((View) object);

	}

	@Override
	public Object instantiateItem(View container, int position) {
		LayoutInflater inflater = (LayoutInflater) container.getContext().getSystemService(
				Context.LAYOUT_INFLATER_SERVICE);
		View view = inflater.inflate(R.layout.home_message_comment_activity, null);
		((ViewPager) container).addView(view, 0);
		return view;
	};

}
